//
//  UI_Property_DemoVC.swift
//  APSwift
//
//  Created by jianbo.pei on 2023/10/9.
//

import UIKit

/// 圆
struct Circle {
    /// 半径
    var radius: Double
    
    /// 直径
    var diameter: Double {
        set {
            radius = newValue / 2
        }
        get {
            radius * 2
        }
    }
}

class UI_Property_DemoVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        var circle = Circle(radius: 5)
        
        circle.radius = 10
        
        circle.diameter = 20
        
        _ = circle.diameter
    }

}
